package com.yue.rpc.serialize;

import com.yue.rpc.extension.SPI;

/**
 * @Author zhangqiyue
 * @Description
 * @Date 2023/3/4 17:11
 */
@SPI
public interface Serializer {
    /**
     * @description: 序列化
     * @author: zhangqiyue
     * @date: 2023/3/4 17:12
     * @param: obj 要序列化的对象
     * @return:
     **/
    byte[] serialize(Object obj);

    /**
     * @description: 反序列化
     * @author: zhangqiyue
     * @date: 2023/3/4 17:13
     * @param: [bytes, clazz]
     * @return:
     **/
    <T> T deserialize(byte[] bytes,Class<T> clazz);
}
